import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:leader_help/value/topcolors.dart';
import 'index.dart';
import 'package:leader_help/utils/util.dart';

class MePage extends StatelessWidget {
  MePage({Key? key}) : super(key: key);
  final controller = Get.put(MeController());
  // 内容页
  Widget _buildView() {
    return Container(
      child: Stack(
        children: [
          Image.asset(
            'bg_mine2.png'.imgPathMe,
            width: 1.sw,
            height: 1.sw * 0.43,
            fit: BoxFit.cover,
          ),
          Column(
            children: [
              SafeArea(
                  child: Container(
                child: Row(
                  children: [
                    InkWell(
                      onTap: () {
                        Get.toNamed(RouterPath.login);
                      },
                      child: Container(
                        child: ClipOval(
                          child: Image.asset('avatar_default.png'.imgPathMe),
                        ),
                        margin: EdgeInsets.only(top: 30, left: 15, right: 25),
                        decoration: BoxDecoration(
                            border: Border.all(color: Colors.white, width: 0),
                            borderRadius:
                                BorderRadius.all(Radius.circular(180))),
                        width: 62,
                        height: 62,
                      ),
                    ),
                    Column(
                      children: [
                        Container(
                          child: Row(children: [
                            Text(
                              '用户名',
                              style: TextStyle(
                                  color: Colors.white,
                                  fontSize: 18.sp,
                                  fontWeight: FontWeight.w600),
                            ),
                            Container(
                              child: Text(
                                '单位',
                                style: TextStyle(
                                  color: Colors.white,
                                  fontSize: 10.sp,
                                ),
                              ),
                              padding: EdgeInsets.fromLTRB(10, 1, 10, 3),
                              margin: EdgeInsets.only(top: 3, left: 10),
                              decoration: BoxDecoration(
                                  color: Color(0xff820404),
                                  borderRadius:
                                      BorderRadius.all(Radius.circular(20))),
                            )
                          ]),
                          margin: EdgeInsets.only(bottom: 10, top: 25),
                        ),
                        Text(
                          '省委书记/省长',
                          style: TextStyle(
                            color: Colors.white,
                            fontSize: 12.sp,
                          ),
                        )
                      ],
                      crossAxisAlignment: CrossAxisAlignment.start,
                    ),
                  ],
                ),
              )),
              GestureDetector(
                child: Container(
                  child: Row(
                    children: [
                      Expanded(
                          child: Text(
                        '意见反馈',
                        style: TextStyle(
                            color: TopColors.black_33,
                            fontSize: 15,
                            fontWeight: FontWeight.w400),
                      )),
                      Text(
                        '提交问题',
                        style:
                            TextStyle(color: TopColors.black_99, fontSize: 12),
                      ),
                      Icon(
                        Icons.chevron_right_sharp,
                        color: TopColors.black_99,
                      )
                    ],
                  ),
                  margin: EdgeInsets.fromLTRB(15, 35, 15, 0),
                  padding: EdgeInsets.fromLTRB(25, 15, 20, 15),
                  decoration: BoxDecoration(
                      color: Colors.white,
                      borderRadius: BorderRadius.all(Radius.circular(5)),
                      boxShadow: [
                        BoxShadow(color: TopColors.gray_f6, blurRadius: 10)
                      ]),
                ),
                onTap: () {
                  Get.toNamed(RouterPath.feed_back);
                },
              ),
              GestureDetector(
                child: Container(
                  child: Row(
                    children: [
                      Expanded(
                          child: Text(
                        '设置',
                        style: TextStyle(
                            color: TopColors.black_33,
                            fontSize: 15,
                            fontWeight: FontWeight.w400),
                      )),
                      Icon(
                        Icons.chevron_right_sharp,
                        color: TopColors.black_99,
                      )
                    ],
                  ),
                  margin: EdgeInsets.all(15),
                  padding: EdgeInsets.fromLTRB(25, 15, 20, 15),
                  decoration: BoxDecoration(
                      color: Colors.white,
                      borderRadius: BorderRadius.all(Radius.circular(5)),
                      boxShadow: [
                        BoxShadow(color: TopColors.gray_f6, blurRadius: 10)
                      ]),
                ),
                onTap: () {
                  Get.toNamed(RouterPath.setup);
                },
              ),
            ],
          )
        ],
      ),
      color: Color(0xfff5f5f7),
    );
  }

  @override
  Widget build(BuildContext context) {
    return GetBuilder<MeController>(
      builder: (_) {
        return Scaffold(
          body: _buildView(),
        );
      },
    );
  }
}
